package cn.cm.controller;

import cn.cm.config.OutData;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author shikundai
 * @date 2021/6/23
 * @time 20:27
 * @description: 异常处理
 */
@RestControllerAdvice
public class ErroController {
    /**
     * 描述：处理Java最大的异常
     * @author shikundai
     * @date 2021/6/23
     * @time 20:29
     */
    @ExceptionHandler(Exception.class)
    public OutData bigErro(Exception e){
        OutData outData=new OutData();
        outData.setCode(500);
        outData.setMsg(e.getMessage());
        return outData;
    }
}
